package state;

import demo.Thread4;

/**
 * Remarks:
 * Class name :Sleep
 * Date :2023/2/14 16:47
 * Author:杨俊源
 */
public class Sleep implements Runnable {

    private int num = 10;

    @Override
    public void run() {
        while (true) {
            if (num <= 0) {
                break;
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + "-->" + num--);
        }
    }

    public static void main(String[] args) {
        Sleep t = new Sleep();
        new Thread(t,"小明1").start();
        new Thread(t,"小明2").start();
        new Thread(t,"小明3").start();
    }
}
